﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace blackhouse.WebNemo.Business.Groups {
    public class GroupCollection : ReadOnlyCollection<IGroup> {

        #region Fields

        private Dictionary<string, IGroup> namedGroups = new Dictionary<string, IGroup>();

        #endregion

        #region Properties

        public IGroup this[string name] {
            get {
                if (this.namedGroups.ContainsKey(name))
                    return this.namedGroups[name];
                else
                    return null;
            }
        }

        #endregion

        #region Constructors

        public GroupCollection(IList<IGroup> collection)
            : base(collection) {
            foreach (IGroup group in collection)
                this.namedGroups.Add(group.SystemName, group);
        }

        #endregion

        #region Methods

        #endregion

    }
}
